package com.itheima.d03_udp;

import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.SocketException;
import java.nio.Buffer;

public class Server {
    public static void main(String[] args) throws Exception {
        DatagramSocket cliernt = new DatagramSocket(10086);
        byte[] bytes = new byte[1024*64];
        int sendMasglength= bytes.length ;
        DatagramPacket packet = new DatagramPacket(bytes,sendMasglength);
        cliernt.receive(packet);
        String msg = new String(packet.getData(),0,packet.getLength());
        System.out.println("数据已接受"+msg);

//     释放资源
        cliernt.close();
    }
}
